from apps.system.rank.baseViews import *

class RankViewSet(BaseRankViewSet):

    def get_queryset(self):
        _ranks = Rank.objects.all()
        return _ranks

    @action(methods=['post'], detail=False)
    def getVipPriceByGrade(self, request):
        params = getRequestParams(self.request)
        grade = params.get('grade')
        if not grade:
            return Response(response_message('grade参数必填'))
        data = None
        if grade == '1':
            data = [
                {'title': '12个月', 'price': '399'},
                {'title': '6个月', 'price': '199'},
                {'title': '3个月', 'price': '129'}
            ]
        elif grade == '2':
            data = [
                {'title': '12个月', 'price': '499'},
                {'title': '6个月', 'price': '299'},
                {'title': '3个月', 'price': '199'}
            ]
        elif grade == '3':
            data = [
                {'title': '12个月', 'price': '999'},
                {'title': '6个月', 'price': '599'},
                {'title': '3个月', 'price': '359'}
            ]
        return Response(response_success(data))